<!DOCTYPE html>


<html lang="zh-CN">
  

    <head>
      <meta charset="utf-8" />
        
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
      <title>我的hexo博客搭建 |  熵</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/favicon.ico" />
       
<link rel="stylesheet" href="/dist/main.css">

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css"
      />
      
<link rel="stylesheet" href="/css/custom.css">
 
      <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    <link rel="alternate" href="/atom.xml" title="熵" type="application/atom+xml">
</head>
  </html>
</html>


<body>
  <div id="app">
    
      <canvas class="fireworks"></canvas>
      <style>
        .fireworks {
          position: fixed;
          left: 0;
          top: 0;
          z-index: 99999;
          pointer-events: none;
        }
      </style>
      
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-我的hexo博客搭建"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  我的hexo博客搭建
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/2021/08/16/%E6%88%91%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="article-date">
  <time datetime="2021-08-16T05:48:44.000Z" itemprop="datePublished">2021-08-16</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA%E7%BB%8F%E9%AA%8C/">博客搭建经验</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.9k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">7 分钟</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <h1 id="我的hexo博客搭建"><a href="#我的hexo博客搭建" class="headerlink" title="我的hexo博客搭建"></a>我的hexo博客搭建</h1><hr>
<blockquote>
<p>此文章为分享我在<strong>mac</strong>上搭建hexo博客的经历</p>
<p>基于b站代码羊<a target="_blank" rel="noopener" href="https://space.bilibili.com/384068749">CodeSheep</a>的视频<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Yb411a7ty">《手把手教你从0开始搭建自己的个人博客 |无坑版视频教程| hexo》</a></p>
</blockquote>
<span id="more"></span>

<h2 id="第一步：安装环境"><a href="#第一步：安装环境" class="headerlink" title="第一步：安装环境"></a>第一步：安装环境</h2><h3 id="1、进入Node-js官网安装Node-js"><a href="#1、进入Node-js官网安装Node-js" class="headerlink" title="1、进入Node.js官网安装Node.js"></a>1、进入<a target="_blank" rel="noopener" href="https://nodejs.org/en/">Node.js官网</a>安装Node.js</h3><p>官网链接<a target="_blank" rel="noopener" href="https://nodejs.org/en/">https://nodejs.org/en/</a></p>
<p>下载安装包，跟着安装包一步一步来就🉑️</p>
<p>通过在命令行（终端/terminal）中输入<code>node -v</code>查看版本号，以检查是否安装成功</p>
<h3 id="2、利用npm安装淘宝镜像源"><a href="#2、利用npm安装淘宝镜像源" class="headerlink" title="2、利用npm安装淘宝镜像源"></a>2、利用npm安装淘宝镜像源</h3><ul>
<li><p>在命令行输入<code>npm install -g cnpm -registry-https://registry.npm.taobao.org </code>将自动安装镜像源</p>
</li>
<li><p>在命令行输入<code>cnpm -v</code>查看版本号，检查是否安装成功</p>
</li>
</ul>
<p>这样就可以使用cnpm工具，下载速度更快</p>
<h3 id="3、安装hexo环境"><a href="#3、安装hexo环境" class="headerlink" title="3、安装hexo环境"></a>3、安装hexo环境</h3><p>在命令行输入<code>cnpm install -g hexo-cli</code>，安装hexo环境</p>
<h3 id="4、新建博客文件夹"><a href="#4、新建博客文件夹" class="headerlink" title="4、新建博客文件夹"></a>4、新建博客文件夹</h3><p><del>emmmmm新建文件夹大家都会吧，叭用我多说了吧</del></p>
<p>以我自己为例子啊</p>
<ul>
<li>在命令行，/user/liusihan目录下，输入<code>mkdir myblog</code>，新建名为”myblog”的文件夹，</li>
</ul>
<p>此文件夹将用于存储博客文件，文件名可自定义嗷</p>
<p><del>后面的博客搭建出现什么问题，大不了整个文件夹删掉重来</del></p>
<h3 id="5、使用hexo生成我们的博客"><a href="#5、使用hexo生成我们的博客" class="headerlink" title="5、使用hexo生成我们的博客"></a>5、使用hexo生成我们的博客</h3><ul>
<li><p>在命令行使用”cd”命令跳转到我们刚刚建好的博客文件夹下</p>
</li>
<li><p>输入<code>sudo hexo init</code>初始化一个博客</p>
</li>
<li><p>初始化结束后，可以用”ls -l”命令，查看该文件夹下生成的文件</p>
</li>
</ul>
<p>“_config.yml”是博客的配置文件，”/source/“是用于存放各个页面的文件夹，”/themes/“用于存放下载的主题</p>
<h3 id="6、在本地查看搭建的博客"><a href="#6、在本地查看搭建的博客" class="headerlink" title="6、在本地查看搭建的博客"></a>6、在本地查看搭建的博客</h3><ul>
<li><p>在<code>&quot;user/liusihan/myblog/&quot;</code>目录下（即我们的博客文件夹目录下），在命令行输入<code>hexo s</code>命令（全称为<code>hexo new</code>）在本地运行博客</p>
</li>
<li><p>输入命令后，可在浏览器地址栏输入”localhost:4000”，即可在4000端口从本地查看博客</p>
</li>
<li><p>要结束运行，在命令行按下”control+c”即可（再次提醒，我用mac搭建的，可能和windows操作方法有点区别，大同小异）</p>
</li>
</ul>
<h2 id="第二步：将本地的博客部署到github-gitee上"><a href="#第二步：将本地的博客部署到github-gitee上" class="headerlink" title="第二步：将本地的博客部署到github/gitee上"></a>第二步：将本地的博客部署到github/gitee上</h2><h3 id="1、注册-登陆到github-gitee（”码云”）"><a href="#1、注册-登陆到github-gitee（”码云”）" class="headerlink" title="1、注册/登陆到github/gitee（”码云”）"></a>1、注册/登陆到<a target="_blank" rel="noopener" href="https://github.com/">github</a>/<a target="_blank" rel="noopener" href="https://gitee.com/">gitee（”码云”）</a></h3><p>部署到github或者gitee上，搭建静态博客，建议可以的话，部署到gitee上，因为github慢，我懒得挂代理👀</p>
<p><del>因为摆烂，反正搭建了也没人看，就自己瞎写写东西，而且懒，并且没钱租服务器</del></p>
<p>以我为例子的话，我这里是部署到<strong>github</strong>上的，gitee的话，可以看看这篇文章<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_38157825/article/details/112783631">Hexo 部署到 Gitee</a> <del>（面向CSDN编程，笑）</del></p>
<ul>
<li><p>新建一个仓库</p>
<p>仓库名字一定是要”你的用户名.github.io”</p>
<p>以我为例，我的用户名为”HalberdSL”，即我用于部署hexo博客的仓库名为”HalberdSL.github.io”（应该是不区分大小写的，反正我分了），Description就随便写</p>
</li>
<li><p>在命令行博客文件夹的目录下，安装一个git部署的插件</p>
<p>以我的为例，在命令行<code>/user/liusihan/myblog</code>目录下，输入命令<code>&quot;cnpm install --save hexo-deployer-git &quot;</code></p>
</li>
<li><p>配置”_config.yml”文件</p>
<p>在命令行<code>/user/liusihan/myblog</code>目录下，输入<code>vim _config.yml</code>指令</p>
<p>找到<code># Deployment</code>这一块</p>
<img src="/2021/08/16/%E6%88%91%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/deploy-github.png" class title="Deployment">

<p>修改为：</p>
<p><code>type: git</code></p>
<p>添加：</p>
<p><code>repo: git@github:HalberdSL/HalberdSl.github.io.git</code></p>
<ul>
<li>此处添加的是自己仓库的链接，建议使用ssh链接，在2021.8.13后，github的https链接好像不可以使用了，会报错）</li>
</ul>
<img src="/2021/08/16/%E6%88%91%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/repository-link.png" class title="仓库链接">

<p><code>branch: master(部署在仓库的主分支)</code></p>
</li>
<li><p>配置好后，在命令行myblog目录下输入<code>sudo hexo cl &amp;&amp; hexo g &amp;&amp; hexo d</code>将其部署到github上</p>
<ul>
<li>hexo cl：即hexo clean，清理缓存</li>
<li>hexo g：即hexo generate，生成文件</li>
<li>hexo d：即hexo deploy，部署文件至github</li>
</ul>
<p>如果是用的https链接，可能会要求输入用户名和密码，如果是用的ssh则不需要</p>
<p>可以在命令行进行配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name &quot;用户名&quot;</span><br><span class="line">git config --global user.email &quot;邮箱&quot;</span><br></pre></td></tr></table></figure></li>
</ul>
<h3 id="2、进行访问"><a href="#2、进行访问" class="headerlink" title="2、进行访问"></a>2、进行访问</h3><p>部署成功后，在浏览器可以用仓库名进行访问，以我的为例”HalberdSL.github.io”</p>
<h2 id="第三步：设置主题"><a href="#第三步：设置主题" class="headerlink" title="第三步：设置主题"></a>第三步：设置主题</h2><p><del>客制化，懂得都懂</del></p>
<h3 id="1、下载主题并配置"><a href="#1、下载主题并配置" class="headerlink" title="1、下载主题并配置"></a>1、下载主题并配置</h3><p>找到自己想要的hexo主题及其github/gitee仓库链接</p>
<p>在命令行用<code>git clone github仓库链接 themes/主题名字 </code>下载主题文件就行了</p>
<p>我用的是叫”ayer”的主题，<a target="_blank" rel="noopener" href="https://shen-yu.gitee.io/">ayer作者的博客</a>，<a target="_blank" rel="noopener" href="https://github.com/Shen-Yu/hexo-theme-ayer">ayer的github链接</a>，我这里就以”ayer”为例子</p>
<ul>
<li><p>在命令行用<code>git clone https://github.com/Shen-Yu/hexo-theme-ayer themes/ayer </code></p>
<p>下载主题文件至 <code>myblog/themes/</code>目录下</p>
</li>
<li><p>在myblog文件夹下，使用命令<code>vim _config.yml</code>修改配置文件</p>
<p>找到<code># Extensions</code>这一块，将<code>themes: landscape</code>中的”landescape”替换为你使用的主题名字，我这里就是替换为”ayer”</p>
<img src="/2021/08/16/%E6%88%91%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/themes.png" class title="修改主题"></li>
<li><p>配置好后，在命令行myblog目录下输入<code>sudo hexo cl &amp;&amp; hexo g &amp;&amp; hexo d</code>将其部署到github上</p>
<p>也可用<code>hexo s</code>在本地预览，修改后再部署到github上</p>
</li>
</ul>
<h3 id="2、设置页面"><a href="#2、设置页面" class="headerlink" title="2、设置页面"></a>2、设置页面</h3><p>博客的具体配置就要看主题的介绍了，建议先到所使用的主题的作者的博客去看看</p>
<ul>
<li><p>在命令行输入<code>hexo new page categories</code>可以新建一个名为”categories”（分类）的页面</p>
<p>标签（tags），友情链接（friends）等同理，取名看自己喜好</p>
</li>
<li><p>新建好页面后，到/source/categories/index.md 文件（这里以”categories”举例，标签友链什么的同理）</p>
<p>将以下复制到该文件中（<code>vim index.md</code>命令）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: categories</span><br><span class="line">type: &quot;categories&quot;</span><br><span class="line">layout: &quot;categories&quot;</span><br><span class="line">---</span><br></pre></td></tr></table></figure></li>
<li><p>在此文件内，就可以新建分类名，例如我就新建了一个”博客搭建经验”的分类</p>
</li>
<li><p><code>sudo hexo cl &amp;&amp; hexo g &amp;&amp; hexo d</code>叭用我多说了吧</p>
</li>
</ul>
<p>具体配置看各个主题不同嗷，不多谈</p>
<h2 id="第四步：写文章"><a href="#第四步：写文章" class="headerlink" title="第四步：写文章"></a>第四步：写文章</h2><h3 id="1、安装图片插件"><a href="#1、安装图片插件" class="headerlink" title="1、安装图片插件"></a>1、安装图片插件</h3><p>写文章嘛，总会遇到想插两张<del>表情包</del>图片什么的时候</p>
<p>markdown语法中的<code>![图片标题](图片.jpg)</code>在这儿好像不起作用，具体请看官网的描述：<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/asset-folders.html">资源文件夹</a></p>
<ul>
<li><p>在命令行输入<code>cnpm install hexo-asset-image --ssave </code>安装插件</p>
</li>
<li><p>打开博客文件夹<code>/user/liusihan/myblog</code>下的配置文件<code>_config.yml</code></p>
<p>将文件中的<code>post_asset_folder</code>选项改为<code>true</code></p>
<p>这样，在新建文章的时候，会同时创建一个和文章同名的文件夹，用于存放文章要添加的图片</p>
</li>
</ul>
<h3 id="2、新建文章"><a href="#2、新建文章" class="headerlink" title="2、新建文章"></a>2、新建文章</h3><ul>
<li><p>在命令行中输入<code>hexo n &quot;文章标题&quot;</code>，即可在<code>/myblog/source/_posts</code>文件夹下新建为”文章标题.md”的markdown文件</p>
<p>如果安装了<code>hexo-asset-image</code>插件的话，还会生成一个同名文件夹</p>
<p>文章是markdown格式的，可以用markdown语法进行编辑</p>
</li>
<li><p>可以通过<code>vim 文章标题.md</code>命令来编辑，或者用Typora打开文章进行编辑</p>
</li>
</ul>
<h3 id="3、添加图片"><a href="#3、添加图片" class="headerlink" title="3、添加图片"></a>3、添加图片</h3><ul>
<li><p>要添加图片时，在文章中输入<code>&#123;% asset_img 想添加的图片.jpg 图片标题%&#125;</code></p>
<p>jpg/jpeg/png好像都🉑️</p>
</li>
<li><p>用md语法添加图片<code>![标题](image.jpg)</code>来添加图片</p>
<p>似乎不会显示在首页或归档中，但是能在文章中正确显示</p>
<p>也可能首页、归档和文章中都无法加载</p>
</li>
</ul>
<h2 id="参考链接："><a href="#参考链接：" class="headerlink" title="参考链接："></a>参考链接：</h2><p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Yb411a7ty">《手把手教你从0开始搭建自己的个人博客 |无坑版视频教程| hexo》</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_38157825/article/details/112783631">Hexo 部署到 Gitee</a></p>
<p><a target="_blank" rel="noopener" href="https://shen-yu.gitee.io/">ayer作者的博客</a></p>
<p><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/asset-folders.html">资源文件夹 | Hexo</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_30734435/article/details/98497054">解决Hexo图片无法显示问题</a></p>
<h3 id="谢谢观看"><a href="#谢谢观看" class="headerlink" title="谢谢观看"></a>谢谢观看</h3> 
      <!-- reward -->
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>版权声明： </strong>
          
          本博客所有文章除特别声明外，著作权归作者所有。转载请注明出处！
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2021/08/16/%E6%88%91%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
    </footer>
  </div>

   
  <nav class="article-nav">
    
    
      <a href="/2021/08/16/%E6%B5%8B%E8%AF%95%E6%96%87%E7%AB%A0testBlog/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">测试文章testBlog</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "",
    app_key: "",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
     
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2015-2021
        <i class="ri-heart-fill heart_icon"></i> Halberd.S.L
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="熵"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友链</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="搜索">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-3.6.0.min.js"></script>
 
<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->
 <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script> 
<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script>

<script src="/js/clickBoom1.js"></script>
 
<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/css/clipboard.css">
 <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    

  </div>
</body>

</html>